<?php

namespace app\api\controller;

use app\common\controller\Api;

/**
 * 首页接口
 */
class Index extends Api
{
    protected $noNeedLogin = ['*'];
    protected $noNeedRight = ['*'];

    /**
     * 首页
     *
     */
    public function index()
    {
        $this->success('请求成功');
    }

    function backOrder()
    {
        $res = $this->request->request();
        model('order')->backOrder($res['order_sn']);

    }
    
    function sendOutGoods(){
        
         $order = model('app\common\model\Order')
            ->where('send_goods',0)
            ->where('status','in','2,3,4')
            ->select();
        
        foreach ($order as $row){
            
            $bool = model('app\common\model\Order')->setOrderStatus($row->id,$row);
            
             model('app\common\model\Order')->where('id',$bool)->update(['send_goods'=>1,'taketime'=>time(),'deliverytime'=>time()]);
            
            if ($bool) {
                
                echo $row->id;
                echo '</br>';
                
            }else {
                
            }
            
        }
        
    }
    
    
}
